package cn.tedu.spring.jdbc;

import com.alibaba.druid.pool.DruidDataSource;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestJdbc {
    @Test
    public void demo01() {
        DruidDataSource druidDataSource = new DruidDataSource();
        druidDataSource.setUrl("jdbc://mysql://localhost:3306/xxx");
        druidDataSource.setUsername("root");
        druidDataSource.setPassword("root");
        druidDataSource.setDriverClassName("com.mysql.....");
    }
    @Test
    public void demo02(){
        ApplicationContext context=new ClassPathXmlApplicationContext
                ("bean-jdbc.xml");
        DruidDataSource druidDataSource=context.getBean
                ("druidDataSource",DruidDataSource.class);
        System.out.println(druidDataSource.getUrl());
    }
}
